import { http } from '@/utils/axios/http'
import { MenuFindDTO, SysMenu } from './menuType'
const api = http.create({ baseURL: process.env.VITE_APP_CIMS_API })

/**
 * 查询菜单列表
 */
const findMenuList = (params: MenuFindDTO) => {
  return api.post('/api/sysMenu/findMenuList', params)
}

/**
 * 查询菜单树
 */
const findMenuTree = (params: MenuFindDTO) => {
  return api.post('/api/sysMenu/findMenuTree', params)
}

/**
 * 保存菜单
 */
const saveMenu = (params: SysMenu) => {
  return api.post('/api/sysMenu/saveMenu', params)
}

/**
 * 删除菜单
 */
const deleteMenu = (menuId: string) => {
  return api.post('/api/sysMenu/deleteMenu', { menuId })
}

export const menuApi = {
  findMenuList,
  findMenuTree,
  saveMenu,
  deleteMenu
}
